//
//  RECNumTwoTableViewCell.m
//  CarFace
//
//  Created by dlios on 15/3/26.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "RECNumTwoTableViewCell.h"

@interface RECNumTwoTableViewCell ()
@property(nonatomic, retain)UILabel *title;
@property(nonatomic, retain)UILabel *publishtiptime;
@property(nonatomic, retain)UIImageView *bgimage;



@end

@implementation RECNumTwoTableViewCell

- (void)dealloc
{
    [_title release];
    [_publishtiptime release];
    [_bgimage release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.title = [[UILabel alloc] init];
        [self.contentView addSubview:self.title];
        self.title.font = [UIFont systemFontOfSize:18];
        [_title release];
        
        self.publishtiptime = [[UILabel alloc] init];
        [self.contentView addSubview:self.publishtiptime];
        self.publishtiptime.font = [UIFont systemFontOfSize:12];
        self.publishtiptime.textColor = [UIColor lightGrayColor];
        [_publishtiptime release];
        
        self.bgimage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.bgimage];
        [_bgimage release];
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    CGFloat width = self.contentView.bounds.size.width;
    CGFloat height = self.contentView.bounds.size.height;
    
//    self.title.frame = CGRectMake(width / 80 , width / 80, width * 39 / 40, height * 3 / 20);
//    self.bgimage.frame = CGRectMake(width / 80 , height * 3 / 20, width * 39 / 40, height * 14 / 20);
//    self.publishtiptime.frame = CGRectMake(width / 80 , height * 17 / 20 , width * 39 / 40, height / 20);
    
    self.title.frame = CGRectMake(width / 80 , width / 80, width * 39 / 40, height * 2 / 20);
    self.bgimage.frame = CGRectMake(width / 80 , height * 3 / 20, width * 39 / 40, height * 14 / 20);
    self.publishtiptime.frame = CGRectMake(width / 80 , height * 17 / 20 , width * 39 / 40, height * 2 / 20);
    

    if (self.numTwolist == nil) {
        return;
    }
    //赋值
    self.title.text = self.numTwolist.title;
    if (0 == self.numTwolist.publishtiptime.length) {
        self.publishtiptime.text = @"发布时间";
    }else{
        self.publishtiptime.text = [NSString stringWithFormat:@"发布时间%@",self.numTwolist.createtime];
    }
    NSString *smallpicStr = [self.numTwolist.bgimage stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSURL *url = [NSURL URLWithString:smallpicStr];
    [self.bgimage setImageWithURL:url];
      
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
